home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 714 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.0 KB

  1. From: kanze@gabi-soft.fr (J. Kanze)
  2. Message-ID: <KANZE.96Mar14132720@gabi.gabi-soft.fr>
  3. X-Original-Date: 14 Mar 1996 12:27:20 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 14 Mar 96 15:23:50 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. Newsgroups: comp.std.c++
  9. Subject: Re: Implementation of class basic_string<class charT, class traits, class Allocator>
  10. Organization: GABI Software, Sarl.
  11. References: <3147413B.B10@trcinc.com>
  12. In-Reply-To: Rich Paul's message of 13 Mar 96 23:46:01 GMT
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMUg6EOEDnX0m9pzZAQFGQAF9FlBshla3FR5KsZvx/Nuti2vOXVlvjkBV
  15.     BW2XUkjV4oyTvhfmaDBP+Tt1ovcx/ezY
  16.     =ZLnP
  17.  
  18. In article <3147413B.B10@trcinc.com> Rich Paul <rpaul@trcinc.com>
  19. writes:
  20.  
  21. |> I am currently implementing, from the working paper, class 
  22. |> basic_string.  I'm not sure on a couple of things.  The first is 
  23. |> if the standard says:
  24.  
  25. |> insert ( const basic_string bs&str )
  26. |>     Does this and that
  27. |> insert ( charT *cp )
  28. |>     insert ( basic_string ( cp );
  29.  
  30. |> am I non-complient if I put the real code in the charT* overload 
  31. |> and have the other call it?  I'm not sure the level of 
  32. |> complience that is required ...
  33.  
  34. At the most, only the externally observable behavior counts.  How you
  35. implement the functions is your business.  (In some cases, certain
  36. variations in the externally observable behavior are also allowed.)
  37.  
  38. |> Also, is there a validation suite that can put this class 
  39. |> through it's paces?
  40.  
  41. Is there a compiler which will compile it if it is complete?
  42.  
  43. |> One more thing ... before calling traits::deallocate, should I 
  44. |> explicitly call destructors on the charT's in my array, since it 
  45. |> may be a class type, or does the definition of charT as being 
  46. |> 'char-like' preclude this?
  47.  
  48. Good question.  In my implementation, I suppose that charT must have a
  49. trivial constructor and destructor, but that is largely because of
  50. laziness on my part; I know of nothing in the standard to support this.
  51.  
  52. Note that the destructors are not the only problem: you also need the
  53. constructors.  More important, when inserting into the stream (and thus
  54. shifting data up), you have to be careful to use the constructor on raw
  55. memory, but assignment on memory that has already been constructed.
  56. Typically, this will mean that you will have to use uninitialized_copy
  57. for part of the shift, and copy_backward for the other.
  58. -- 
  59. James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
  60. GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
  61. Conseils, itudes et rialisations en logiciel orienti objet --
  62.               -- A la recherche d'une activiti dans une region francophone
  63. ---
  64. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  65. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  66. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  67. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  68. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  69.